<template>
    <div>
        <el-breadcrumb
            separator-class="el-icon-arrow-right"
            class="breadcrumb-base"
            style="line-height: 30px;"
        >
            <el-breadcrumb-item>
                <i class="el-icon-monitor"></i>
                机构概览
            </el-breadcrumb-item>
        </el-breadcrumb>

        <!--四个版头 start-->
        <el-row>
            <el-col
                :span="12"
                style="padding: 0 20px"
            >
                <el-card
                    :body-style="{ padding: '0 20px' }"
                    style="height: 120px"
                >
                    <el-row
                        style="height: 120px;"
                        type="flex"
                        align="middle"
                        justify="space-around"
                    >
                        <el-col
                            :span="3"
                            class="col-style"
                            style="font-size: 12px;"
                        >
                            使用人数
                        </el-col>
                        <el-col
                            :span="3"
                            class="col-style"
                            v-for="item in overViewInfo.institutionUserList"
                            :key="item.index"
                        >
                            <span style="font-size: 12px;cursor:pointer">{{item.userRole}}</span>
                            <br>
                            <div @click="showDoctorDialog">
                                <span style="font-size: 24px;
                                    font-weight: bolder;
                                    cursor:pointer">{{ item.userCount }}</span>
                                <br>
                            </div>
                        </el-col>
                    </el-row>
                </el-card>
            </el-col>
            <el-col
                :span="12"
                style="padding: 0 20px"
            >
                <el-card
                    :body-style="{ padding: '0 20px' }"
                    style="height: 120px"
                >
                    <el-row
                        style="height: 120px;"
                        type="flex"
                        align="middle"
                        justify="space-around"
                    >
                        <el-col
                            :span="3"
                            class="col-style"
                            style="font-size: 12px;"
                        >院内诊断
                        </el-col>

                        <el-col
                            :span="3"
                            class="col-style"
                        >
                            <span style="font-size: 12px;cursor:pointer">今日核发</span>
                            <br>
                            <div>
                                <span style="font-size: 24px;
                                    font-weight: bolder;cursor:pointer">{{ overViewInfo.institutionDiagnosis.toDayIssuedCount }}</span>
                                <br>
                            </div>
                        </el-col>
                        <el-col
                            :span="3"
                            class="col-style"
                        >
                            <span style="font-size: 12px;cursor:pointer">待发报告</span>
                            <br>
                            <div>
                                <span style="font-size: 24px;
                                    font-weight: bolder;cursor:pointer">{{ overViewInfo.institutionDiagnosis.toDayWaitIssuedCount }}</span>
                                <br>
                            </div>
                        </el-col>
                        <el-col
                            :span="3"
                            class="col-style"
                        >
                            <span style="font-size: 12px;cursor:pointer">今日冰冻</span>
                            <br>
                            <div>
                                <span style="font-size: 24px;
                                    font-weight: bolder;cursor:pointer">{{ overViewInfo.institutionDiagnosis.toDayFrozenCount }}</span>
                                <br>
                            </div>
                        </el-col>
                        <el-col
                            :span="3"
                            class="col-style"
                        >
                            <span style="font-size: 12px;cursor:pointer">待发冰冻</span>
                            <br>
                            <div>
                                <span style="font-size: 24px;
                                    font-weight: bolder;cursor:pointer">{{ overViewInfo.institutionDiagnosis.toDayWaitIssuedFrozenCount }}</span>
                                <br>
                            </div>
                        </el-col>
                        <el-col
                            :span="3"
                            class="col-style"
                        >
                            <span style="font-size: 12px;cursor:pointer">待发超时</span>
                            <br>
                            <div>
                                <span style="font-size: 24px;
                                    font-weight: bolder;cursor:pointer">{{ overViewInfo.institutionDiagnosis.toDayIssuedTimeoutFrozenCount }}</span>
                                <br>
                            </div>
                        </el-col>
                        <el-col
                            :span="3"
                            class="col-style"
                        >
                            <span style="font-size: 12px;cursor:pointer">累计核发</span>
                            <br>
                            <div>
                                <span style="font-size: 24px;
                                    font-weight: bolder;cursor:pointer">{{ overViewInfo.institutionDiagnosis.sumIssuedCount }}</span>
                                <br>
                            </div>
                        </el-col>
                        <el-col
                            :span="3"
                            class="col-style"
                        >
                            <span style="font-size: 12px;cursor:pointer">累计超时</span>
                            <br>
                            <div>
                                <span style="font-size: 24px;
                                    font-weight: bolder;cursor:pointer">{{ overViewInfo.institutionDiagnosis.sumIssuedTimeoutCount }}</span>
                                <br>
                            </div>
                        </el-col>
                    </el-row>
                </el-card>
            </el-col>
        </el-row>
        <el-row>
            <el-col
                :span="12"
                style="padding: 0 20px"
            >
                <el-card
                    :body-style="{ padding: '0 20px' }"
                    style="height: 120px"
                >
                    <el-row
                        style="height: 120px;"
                        type="flex"
                        align="middle"
                        justify="space-around"
                    >
                        <el-col
                            :span="3"
                            class="col-style"
                            style="font-size: 12px;"
                        >会诊情况
                        </el-col>

                        <el-col
                            :span="3"
                            class="col-style"
                        >
                            <span style="font-size: 12px;cursor:pointer">今日送出会诊</span>
                            <br>
                            <div>
                                <span style="font-size: 24px;
                                    font-weight: bolder;cursor:pointer">*</span>
                                <br>
                            </div>
                        </el-col>
                        <el-col
                            :span="3"
                            class="col-style"
                        >
                            <span style="font-size: 12px;cursor:pointer">今日接受会诊</span>
                            <br>
                            <div>
                                <span style="font-size: 24px;
                                    font-weight: bolder;cursor:pointer">*</span>
                                <br>
                            </div>
                        </el-col>
                        <el-col
                            :span="3"
                            class="col-style"
                        >
                            <span style="font-size: 12px;cursor:pointer">今日科内会诊</span>
                            <br>
                            <div>
                                <span style="font-size: 24px;
                                    font-weight: bolder;cursor:pointer">*</span>
                                <br>
                            </div>
                        </el-col>
                        <el-col
                            :span="3"
                            class="col-style"
                        >
                            <span style="font-size: 12px;cursor:pointer">累计送出会诊</span>
                            <br>
                            <div>
                                <span style="font-size: 24px;
                                    font-weight: bolder;cursor:pointer">*</span>
                                <br>
                            </div>
                        </el-col>
                        <el-col
                            :span="3"
                            class="col-style"
                        >
                            <span style="font-size: 12px;cursor:pointer">累计接受会诊</span>
                            <br>
                            <div>
                                <span style="font-size: 24px;
                                    font-weight: bolder;cursor:pointer">*</span>
                                <br>
                            </div>
                        </el-col>
                        <el-col
                            :span="3"
                            class="col-style"
                        >
                            <span style="font-size: 12px;cursor:pointer">累计科内会诊</span>
                            <br>
                            <div>
                                <span style="font-size: 24px;
                                    font-weight: bolder;cursor:pointer">*</span>
                                <br>
                            </div>
                        </el-col>

                    </el-row>
                </el-card>
            </el-col>
            <el-col
                :span="12"
                style="padding: 0 20px"
            >
                <el-card
                    :body-style="{ padding: '0 20px' }"
                    style="height: 120px"
                >
                    <el-row
                        style="height: 120px;"
                        type="flex"
                        align="middle"
                        justify="space-around"
                    >
                        <el-col
                            :span="3"
                            class="col-style"
                            style="font-size: 12px;"
                        >
                            切片情况
                        </el-col>
                        <el-col
                            :span="3"
                            class="col-style"
                        >
                            <span style="font-size: 12px;cursor:pointer">切片总数</span>
                            <br>
                            <div>
                                <span style="font-size: 24px;
                                    font-weight: bolder;cursor:pointer">{{overViewInfo.institutionBiopsyWithStorage.biopsySumCount}}</span>
                                <br>
                            </div>
                        </el-col>
                        <el-col
                            :span="3"
                            class="col-style"
                        >
                            <span style="font-size: 12px;cursor:pointer">HE切片</span>
                            <br>
                            <div>
                                <span style="font-size: 24px;
                                    font-weight: bolder;cursor:pointer">{{overViewInfo.institutionBiopsyWithStorage.hebiopsySumCount}}</span>
                                <br>
                            </div>
                        </el-col>
                        <el-col
                            :span="3"
                            class="col-style"
                        >
                            <span style="font-size: 12px;cursor:pointer">免疫组化切片</span>
                            <br>
                            <div>
                                <span style="font-size: 24px;
                                    font-weight: bolder;cursor:pointer">{{overViewInfo.institutionBiopsyWithStorage.immunohistochemicalBiopsySumCount}}</span>
                                <br>
                            </div>
                        </el-col>
                        <el-col
                            :span="6"
                            class="col-style"
                        >
                            <span style="font-size: 12px;cursor:pointer">总存贮容量/剩余存贮容量</span>
                            <br>
                            <div>
                                <span style="font-size: 24px;
                                    font-weight: bolder;cursor:pointer">{{overViewInfo.institutionBiopsyWithStorage.storage}}</span>
                                <br>
                            </div>
                        </el-col>
                        <el-col
                            :span="3"
                            class="col-style"
                        >
                            <span style="font-size: 12px;cursor:pointer">剩余存贮容量百分比</span>
                            <br>
                            <div>
                                <span style="font-size: 24px;
                                    font-weight: bolder;cursor:pointer">{{overViewInfo.institutionBiopsyWithStorage.unUsedStorageProportionStr}}%</span>
                                <br>
                            </div>
                        </el-col>
                    </el-row>
                </el-card>
            </el-col>

        </el-row>
        <!--四个版头 end-->
        <!-- 医生列表弹窗 start -->
        <el-dialog
            title="医生列表"
            :visible.sync="dialogTableVisible"
            width="70%"
        >
            <el-table
                :data="doctorData"
                border
                :cell-style="{'text-align':'center'}"
                :header-cell-style="{
              'background-color': '#E6E9EF',
              'color':'#777C7C',
              'font-weight':'400',
              'font-size' : '15px',
              'border-right': '1px solid #ffffff',
              'text-align':'center'}"
                size="mini"
                style="width: 100%;margin-top: 20px;"
            >
                <el-table-column
                    prop="name"
                    label="姓名"
                >
                </el-table-column>
                <el-table-column
                    prop="gender"
                    label="性别"
                >
                </el-table-column>
                <el-table-column
                    prop="jobNumber"
                    label="工号"
                >
                </el-table-column>
                <el-table-column
                    prop="phone"
                    label="手机号"
                    width="120"
                >
                </el-table-column>
                <!-- <el-table-column
              prop="positionName"
              label="职级">
            </el-table-column>
            <el-table-column
              prop="medicalTitleName"
              label="职称">
            </el-table-column> -->
                <el-table-column
                    prop="createTime"
                    label="注册时间"
                >
                </el-table-column>
                <!-- <el-table-column
              prop="area"
              label="所在地">
            </el-table-column> -->
                <el-table-column
                    prop="status"
                    label="用户状态"
                >
                </el-table-column>
            </el-table>
            <el-row
                style="margin-top: 10px"
                align="right"
            >
                <el-pagination
                    @current-change="handleCurrentChange"
                    @size-change="handleSizeChange"
                    :current-page="pageInfo.page+1"
                    :page-size="pageInfo.size"
                    :page-sizes="[10, 15, 20]"
                    :total="pageInfo.total"
                    style="text-align: center; margin-top: 12px;"
                    layout="sizes, prev, pager, next, total"
                >
                </el-pagination>
            </el-row>
        </el-dialog>
        <!-- 医生列表弹窗 end -->
        <!--统计折线图 start-->
        <el-row style="padding: 10px 20px 0">
            <el-card :body-style="{ padding: '5px' }">
                <el-row style="z-index: 1; margin-bottom: -10px">
                    <el-date-picker
                        v-model="dateRange1"
                        type="daterange"
                        @change="selectTime($event,1)"
                        size="mini"
                        style="float: right;right: 10px"
                        range-separator="-"
                        start-placeholder="开始日期"
                        end-placeholder="结束日期"
                        :default-time="['00:00:00', '23:59:59']"
                    >
                    </el-date-picker>
                    <el-button
                        type="text"
                        size="small"
                        @click="showYear(1)"
                        style="margin-right: 40px;float: right"
                    >本年
                    </el-button>
                    <el-button
                        type="text"
                        size="small"
                        @click="showMonth(1)"
                        style="float: right;margin-right: 20px"
                    >本月
                    </el-button>
                    <el-button
                        type="text"
                        size="small"
                        @click="showWeek(1)"
                        style="float: right;margin-right: 20px"
                    >本周
                    </el-button>
                </el-row>
                <div
                    id="main"
                    style="height: 270px;width:100%;"
                ></div>

                <!-- <el-row style="top: -28px; z-index: 0">
                    <consultation-pic :servicedata="ApplicationsPicCursor"
                                      :appdata="ApplicationsOrgCursor"
                                      :diagnosedata1="ApplicationHospitalOrgCursor"
                                      :diagnosedata2="ServiceCentersCursor">
                    </consultation-pic>
                </el-row> -->
            </el-card>
        </el-row>
        <el-row style="padding: 10px 20px 0">
            <el-card :body-style="{ padding: '5px' }">
                <el-row style="z-index: 1; margin-bottom: -10px">
                    <el-date-picker
                        v-model="dateRange2"
                        type="daterange"
                        @change="selectTime($event,2)"
                        size="mini"
                        style="float: right;right: 10px"
                        range-separator="-"
                        start-placeholder="开始日期"
                        end-placeholder="结束日期"
                        :default-time="['00:00:00', '23:59:59']"
                    >
                    </el-date-picker>
                    <el-button
                        type="text"
                        size="small"
                        @click="showYear(2)"
                        style="margin-right: 40px;float: right"
                    >本年
                    </el-button>
                    <el-button
                        type="text"
                        size="small"
                        @click="showMonth(2)"
                        style="float: right;margin-right: 20px"
                    >本月
                    </el-button>
                    <el-button
                        type="text"
                        size="small"
                        @click="showWeek(2)"
                        style="float: right;margin-right: 20px"
                    >本周
                    </el-button>
                </el-row>
                <div
                    id="biopsyOption"
                    style="height: 270px;width:100%;"
                ></div>
            </el-card>
        </el-row>
        <el-row style="padding: 10px 20px 0">
            <el-card :body-style="{ padding: '5px' }">
                <el-row style="z-index: 1; margin-bottom: -10px">
                    <el-date-picker
                        v-model="dateRange3"
                        type="daterange"
                        @change="selectTime($event,3)"
                        size="mini"
                        style="float: right;right: 10px"
                        range-separator="-"
                        start-placeholder="开始日期"
                        end-placeholder="结束日期"
                        :default-time="['00:00:00', '23:59:59']"
                    >
                    </el-date-picker>
                    <el-button
                        type="text"
                        size="small"
                        @click="showYear(3)"
                        style="margin-right: 40px;float: right"
                    >本年
                    </el-button>
                    <el-button
                        type="text"
                        size="small"
                        @click="showMonth(3)"
                        style="float: right;margin-right: 20px"
                    >本月
                    </el-button>
                    <el-button
                        type="text"
                        size="small"
                        @click="showWeek(3)"
                        style="float: right;margin-right: 20px"
                    >本周
                    </el-button>
                </el-row>
                <div
                    id="consulationOption"
                    style="height: 270px;width:100%;"
                ></div>
            </el-card>
        </el-row>
        <!--统计折线图 end-->
        <!--三个板块统计 start-->
        <el-row
            style="margin-bottom: 20px"
            v-show="true"
        >
            <el-col
                :span="8"
                style="padding: 20px"
            >
                <el-card
                    :body-style="{ padding: '0px' }"
                    style="height: 400px"
                >
                    <el-row
                        style="height: 60px; padding: 0 20px"
                        type="flex"
                        align="middle"
                        justify="space-between"
                    >
                        <span>院内诊断数量统计</span>
                        <div>
                            <el-select
                                v-model="blzdvalue"
                                size="mini"
                                style="width: 100px"
                                @change="blzdchangeDate"
                                placeholder="请选择"
                            >
                                <el-option
                                    v-for="item in options"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                >
                                </el-option>
                            </el-select>
                            <!--                            <el-button-->
                            <!--                                size="small"-->
                            <!--                                @click="blzddialogVisible = true"-->
                            <!--                                type="text"-->
                            <!--                            >-->
                            <!--                                更多-->
                            <!--                            </el-button>-->
                        </div>
                    </el-row>
                    <el-row
                        type="flex"
                        justify="center"
                    >
                        <el-table
                            :data="hospitalDiagnoseTableData"
                            stripe
                            :header-cell-style="{'background-color': '#E6E9EF',
                                  'color':'#777C7C','font-weight':'400',
                                  'border-right': '1px solid #ffffff'}"
                            :cell-style="{padding:'3px 0',
                                  'border-right': '1px solid #ffffff'}"
                            height="300"
                            size="mini"
                            style="max-width: 380px"
                        >
                            <el-table-column
                                prop="order"
                                label="排名"
                                width="80"
                            >
                            </el-table-column>
                            <el-table-column
                                prop="name"
                                label="姓名"
                                width="150"
                            >
                            </el-table-column>
                            <el-table-column
                                prop="count"
                                label="诊断数量"
                                width="150"
                            >
                            </el-table-column>
                        </el-table>
                    </el-row>
                </el-card>
            </el-col>
            <el-col
                :span="8"
                style="padding: 10px"
            >
                <el-card
                    :body-style="{ padding: '0px' }"
                    style="height: 400px"
                >
                    <el-row
                        style="height: 60px; padding: 0 20px"
                        type="flex"
                        align="middle"
                        justify="space-between"
                    >
                        <span>机构申请会诊排行榜</span>
                        <div>
                            <el-select
                                v-model="jgsqvalue"
                                size="mini"
                                style="width: 100px"
                                @change="changeDate"
                                placeholder="请选择"
                            >
                                <el-option
                                    v-for="item in options"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                >
                                </el-option>
                            </el-select>
                            <!--                            <el-button-->
                            <!--                                size="small"-->
                            <!--                                @click="jgsqdialogVisible = true"-->
                            <!--                                type="text"-->
                            <!--                            >-->
                            <!--                                更多-->
                            <!--                            </el-button>-->
                        </div>
                    </el-row>
                    <!-- <el-row type="flex" justify="center">
                        <el-table :data="applicationTableData"
                                  stripe
                                  :header-cell-style="{'background-color': '#E6E9EF',
                                   'color':'#777C7C','font-weight':'400',
                                   'border-right': '1px solid #ffffff'}"
                                  :cell-style="{padding:'3px 0',
                                  'border-right': '1px solid #ffffff'}"
                                  size="mini"
                                  height="300"
                                  style="max-width: 400px">
                            <el-table-column
                                    prop="index"
                                    label="排名"
                                    size="mini"
                                    width="60">
                            </el-table-column>
                            <el-table-column
                                    prop="name"
                                    label="机构"
                                    width="120">
                            </el-table-column>
                            <el-table-column
                                    prop="percent"
                                    label="占比"
                                    width="120">
                                <template slot-scope="scope">
                                    <el-progress :percentage="scope.row.percentNumber">

                                    </el-progress>
                                </template>
                            </el-table-column>
                            <el-table-column
                                    prop="count"
                                    label="申请量"
                                    width="100">
                            </el-table-column>
                        </el-table>
                    </el-row> -->
                </el-card>
            </el-col>
            <el-col
                :span="8"
                style="padding: 10px"
            >
                <el-card
                    :body-style="{ padding: '0px' }"
                    style="height: 400px"
                >
                    <el-row
                        style="height: 60px; padding: 0 20px"
                        type="flex"
                        align="middle"
                        justify="space-between"
                    >
                        <span>病理会诊量排行榜</span>
                        <!--                        <el-button-->
                        <!--                            size="small"-->
                        <!--                            @click="hzldialogVisible = true"-->
                        <!--                            type="text"-->
                        <!--                        >-->
                        <!--                            更多-->
                        <!--                        </el-button>-->
                    </el-row>
                    <el-row
                        type="flex"
                        justify="center"
                    >
                        <!-- <el-table :data="checkServiceData"
                                  stripe
                                  :header-cell-style="{'background-color': '#E6E9EF',
                                   'color':'#777C7C','font-weight':'400',
                                   'border-right': '1px solid #ffffff'}"
                                  :cell-style="{padding:'3px 0',
                                  'border-right': '1px solid #ffffff'}"
                                  size="mini"
                                  height="300"
                                  style="max-width: 400px">
                            <el-table-column
                                    prop="index"
                                    label="排名"
                                    size="mini"
                                    width="60">
                            </el-table-column>
                            <el-table-column
                                    prop="name"
                                    label="姓名"
                                    width="80">
                            </el-table-column>
                            <el-table-column
                                    prop="serviceCenter"
                                    label="申请机构"
                                    width="160">
                            </el-table-column>
                            <el-table-column
                                    prop="count"
                                    label="会诊量"
                                    width="100">
                            </el-table-column>
                        </el-table> -->
                    </el-row>
                </el-card>
            </el-col>
        </el-row>
        <!--三个板块统计 end-->
    </div>
</template>

<script>
import moment from 'moment';
const echarts = require('echarts');
const myDate = new Date();
const time = myDate.toLocaleDateString().split('/').join('-');
const times = time.split('-');
const Year = times[0];
const Month = times[1];
const days = new Date(Year, Month, 0);
const dm = days.getDate();
const consulationOption = {
    title: {
        text: '会诊数量趋势图',
    },
    tooltip: {
        trigger: 'axis',
    },
    xAxis: {
        type: 'category',
        boundaryGap: false,
        data: [],
    },
    yAxis: {
        type: 'value',
    },
    series: [
        {
            data: [],
            type: 'line',
            areaStyle: {},
        },
    ],
    grid: {
        bottom: '20px', // 与容器底部的距离
    },
};
const biopsyOption = {
    title: {
        text: '切片增加趋势图',
    },
    tooltip: {
        trigger: 'axis',
    },
    xAxis: {
        type: 'category',
        boundaryGap: false,
        data: [],
    },
    yAxis: {
        type: 'value',
    },
    series: [
        {
            data: [],
            type: 'line',
            areaStyle: {},
        },
    ],
    grid: {
        bottom: '20px', // 与容器底部的距离
    },
};
const option = {
    title: {
        text: '诊断数量趋势图',
    },
    tooltip: {
        trigger: 'axis',
    },
    xAxis: {
        type: 'category',
        boundaryGap: false,
        data: [],
    },
    yAxis: {
        type: 'value',
    },
    series: [
        {
            data: [],
            type: 'line',
            areaStyle: {},
        },
    ],
    grid: {
        bottom: '20px', // 与容器底部的距离
    },
};

export default {
    name: 'OrganizationOperations',
    /* 数据返回 配合时间选择 */
    data() {
        return {
            pageInfo: {
                page: 0,
                size: 15,
                total: 10,
            },
            dialogTableVisible: false,
            doctorData: [],
            dateRange1: [],
            dateRange2: [],
            dateRange3: [],
            blzddateRange: [],
            orgappdateRange: [],
            options: [
                {
                    value: '1',
                    label: '本年',
                },
                {
                    value: '2',
                    label: '本月',
                },
                {
                    value: '3',
                    label: '本周',
                },
            ],
            typeoptions: [
                {
                    value: '1',
                    label: '全部类型',
                },
                {
                    value: '2',
                    label: '普通会诊',
                },
                {
                    value: '3',
                    label: '术中冰冻',
                },
            ],
            // 签约机构数量
            follow: '',
            // 签约专家数量
            signExpertCount: '',
            // 院内诊断数量
            diagnosisCount: '',
            // 用户数量
            userCount: '',
            service: '',
            blzdvalue: '',
            jgsqvalue: '',
            zjhzlvalue: '',
            operationtype: '',
            blzddialogVisible: false,
            jgsqdialogVisible: false,
            hzldialogVisible: false,
            // applicationCount: '',
            hospitalDiagnoseTableData: [],
            overViewInfo: {
                institutionUserList: [],
                institutionDiagnosis: {},
                institutionBiopsyWithStorage: {},
            },
            activeStatus: 0,
        };
    },
    computed: {},
    mounted() {
        const nowDate = new Date().getTime();
        const preSevenDate = new Date().getTime() - 24 * 60 * 60 * 1000 * 7;
        const nowTime = this.getFormotTime(nowDate);
        const preSevenTime = this.getFormotTime(preSevenDate);
        this.getDiagnosisEchartsData(preSevenTime, nowTime);
        // 诊断数量趋势图数据写入
        this.drawLine();
        this.drawBiopsyOption();
        this.drawConsulationOption();
        // 页面统计信息
        this.signCount();
        // 诊断数量折线
        // this.diagnosis();
        // 院内诊断数量统计
        this.diagnosisTJ();
        this.getOverViewInfo();
    },
    /* 选择日期时间时联动方法 本周本月本年 */
    methods: {
        getFormotTime(time) {
            const now = new Date(time);
            const year = now.getFullYear(); //得到年份
            const month =
                now.getMonth() + 1 < 10
                    ? '0' + (now.getMonth() + 1)
                    : now.getMonth() + 1; //得到月份
            const date =
                now.getDate() < 10 ? '0' + now.getDate() : now.getDate(); //得到日期
            const hour = now.getHours(); //得到小时数
            const minute =
                now.getMinutes() < 10
                    ? '0' + now.getMinutes()
                    : now.getMinutes(); //得到分钟数
            const second =
                now.getSeconds() < 10
                    ? '0' + now.getSeconds()
                    : now.getSeconds(); //得到秒数
            const nowDateTime =
                year +
                '-' +
                month +
                '-' +
                date +
                ' ' +
                hour +
                ':' +
                minute +
                ':' +
                second;
            return nowDateTime;
        },
        getDiagnosisEchartsData(startTime, endTime) {
            this.$axios({
                // 详见 axios 请求配置项
                method: 'GET',
                url: '/PROXY-Remote/institutions/getStatisticsGrouping/forInstitutionOverview',
                params: {
                    pEndDate: endTime,
                    pStartDate: startTime,
                },
            }).then((result) => {
                // 请求失败
                if (result.data.code !== 200) {
                    throw new Error(result.data);
                }
                if (this.activeStatus === 1 || this.activeStatus === 0) {
                    const x = [];
                    const y = [];
                    // 有数据
                    if (result.data.data.diagnosisDetail.length !== 0) {
                        for (
                            let i = 0;
                            i < result.data.data.diagnosisDetail.length;
                            i++
                        ) {
                            const map = result.data.data.diagnosisDetail;
                            x.push(map[i].dateField);
                            y.push(map[i].countField);
                        }
                    } else {
                        const s = `${startTime}`.substr(0, 10);
                        const e = `${endTime}`.substr(0, 10);
                        x.push(s, e);
                        y.push(0, 0);
                    }
                    option.series[0].data = y;
                    option.xAxis.data = x;
                    this.drawLine();
                }
                if (this.activeStatus === 2 || this.activeStatus === 0) {
                    const mx = [];
                    const my = [];
                    if (result.data.data.biopsy.length !== 0) {
                        for (
                            let i = 0;
                            i < result.data.data.biopsy.length;
                            i++
                        ) {
                            const map = result.data.data.biopsy;
                            mx.push(map[i].dateField);
                            my.push(map[i].countField);
                        }
                    } else {
                        const s = `${startTime}`.substr(0, 10);
                        const e = `${endTime}`.substr(0, 10);
                        mx.push(s, e);
                        my.push(0, 0);
                    }
                    biopsyOption.series[0].data = my;
                    biopsyOption.xAxis.data = mx;
                    this.drawBiopsyOption();
                }
                if (this.activeStatus === 3 || this.activeStatus === 0) {
                    const cx = [];
                    const cy = [];
                    if (result.data.data.diagnosis.length !== 0) {
                        for (
                            let i = 0;
                            i < result.data.data.diagnosis.length;
                            i++
                        ) {
                            const map = result.data.data.diagnosis;
                            cx.push(map[i].dateField);
                            cy.push(map[i].countField);
                        }
                    } else {
                        const s = `${startTime}`.substr(0, 10);
                        const e = `${endTime}`.substr(0, 10);
                        cx.push(s, e);
                        cy.push(0, 0);
                    }
                    consulationOption.series[0].data = cy;
                    consulationOption.xAxis.data = cx;
                    this.drawConsulationOption();
                }
            });
        },
        getOverViewInfo() {
            const that = this;
            that.$axios({
                // 详见 axios 请求配置项
                method: 'GET',
                url: '/PROXY-Remote/institutions/getStatisticsNumber/forInstitutionOverview',
            }).then((res) => {
                // 请求成功
                if (res.data.code === 200) {
                    const result = res.data.data;
                    console.log(result);
                    that.overViewInfo.institutionUserList =
                        result.institutionUserList;
                    that.overViewInfo.institutionDiagnosis =
                        result.institutionDiagnosis;
                    that.overViewInfo.institutionBiopsyWithStorage =
                        result.institutionBiopsyWithStorage;
                }
            });
        },
        // 页面统计
        async signCount() {
            const that = this;
            try {
                this.$axios({
                    // 详见 axios 请求配置项
                    method: 'GET',
                    url: '/PROXY-Remote/institutions/statistics',
                    params: {
                        page: that.pageInfo.page,
                        size: that.pageInfo.size,
                    },
                }).then((d) => {
                    // 请求失败
                    if (d.data.code !== 200) {
                        throw new Error(d.data);
                    }
                    // 请求成功
                    that.follow = d.data.data.signedInstitutionCount;
                    that.service = d.data.data.serviceInstitutionCount;
                    that.diagnosisCount = d.data.data.diagnosisCount;
                    that.signExpertCount = d.data.data.signExpertCount;
                    that.userCount = d.data.data.userCount;
                    const resultUserInfo = d.data.data.userInfo;
                    resultUserInfo.forEach((t, index) => {
                        // if (t.status === 1) {
                        //     resultUserInfo.splice(index, 1);
                        //     console.log('resultUserInfo', resultUserInfo);
                        // }
                        t.status =
                            t.status === 1
                                ? '冻结'
                                : t.status === 0
                                ? '正常'
                                : '';
                        t.gender =
                            t.gender === 283
                                ? '男'
                                : t.gender === 284
                                ? '女'
                                : '';
                    });
                    that.doctorData = resultUserInfo;
                    that.pageInfo = d.data.pageInfo;
                });
            } catch (e) {
                // 跳出
            }
        },
        // 绘制图表
        drawLine() {
            // 基于准备好的dom，初始化echarts实例
            const myCharts = this.$echarts.init(
                document.getElementById('main')
            );
            // 绘制图表
            myCharts.setOption(option);
        },
        drawBiopsyOption() {
            // 基于准备好的dom，初始化echarts实例
            const myCharts = this.$echarts.init(
                document.getElementById('biopsyOption')
            );
            // 绘制图表
            myCharts.setOption(biopsyOption);
        },
        drawConsulationOption() {
            // 基于准备好的dom，初始化echarts实例
            const myCharts = this.$echarts.init(
                document.getElementById('consulationOption')
            );
            // 绘制图表
            myCharts.setOption(consulationOption);
        },
        // 诊断数量趋势图
        // async diagnosis(startTime, endTime) {
        //     try {
        //         this.$axios({
        //             // 详见 axios 请求配置项
        //             method: 'GET',
        //             url: '/PROXY-Remote/diagnosis/grouping',
        //             params: {
        //                 dateEnd: endTime,
        //                 dateStart: startTime,
        //             },
        //         }).then((result) => {
        //             // 请求失败
        //             if (result.data.code !== 200) {
        //                 throw new Error(result.data);
        //             }
        //             const x = [];
        //             const y = [];
        //             // 有数据
        //             if (result.data.data.length !== 0) {
        //                 for (let i = 0; i < result.data.data.length; i++) {
        //                     const map = result.data.data;
        //                     x.push(map[i].dateField);
        //                     y.push(map[i].countField);
        //                 }
        //             } else {
        //                 const s = `${startTime}`.substr(0, 11);
        //                 const e = `${endTime}`.substr(0, 11);
        //                 x.push(s, e);
        //                 y.push(0, 0);
        //             }
        //             option.series[0].data = y;
        //             option.xAxis.data = x;
        //             this.drawLine();
        //         });
        //     } catch (e) {
        //         // 跳出
        //     }
        // },
        // 院内诊断数量统计
        diagnosisTJ(startTime, endTime) {
            try {
                this.$axios({
                    // 详见 axios 请求配置项
                    method: 'GET',
                    url: '/PROXY-Remote/diagnosis/doctorDiaMum',
                    params: {
                        dateEnd: endTime,
                        dateStart: startTime,
                    },
                }).then((result) => {
                    // 请求失败
                    if (result.data.code !== 200) {
                        throw new Error(result.data);
                    }
                    result.data.data.forEach((item, index) => {
                        item.order = index + 1;
                    });
                    this.hospitalDiagnoseTableData = result.data.data;
                });
            } catch (e) {
                // 跳出
            }
        },
        baseRequest(url, type, params, successFun, failFun) {
            try {
                const { state } = this.$store;
                this.$axios({
                    method: type,
                    url,
                    params,
                    headers: {
                        authorization: state.authorization,
                    },
                }).then((res) => {
                    // 请求失败
                    if (res.data.code !== 200) {
                        failFun(res);
                        throw new Error(res.data);
                    }
                    // 请求成功
                    successFun(res);
                    this.drawLine();
                });
            } catch (e) {
                // 跳出
            }
        },
        showYear(i) {
            this.activeStatus = i;
            const setYearFrom = new Date(Year, 0, 1);
            const setYearTo = new Date(Year, 11, 31);
            const start = moment(setYearFrom).format('YYYY-MM-DD hh:mm:ss');
            const end = moment(setYearTo).format('YYYY-MM-DD hh:mm:ss');
            if (i === 1 || i === 2 || i === 3) {
                this['dateRange' + i] = [setYearFrom, setYearTo];
                this.getDiagnosisEchartsData(start, end);
            } else if (i === 4) {
                this.blzddateRange = [setYearFrom, setYearTo];
                this.diagnosisTJ(start, end);
            }
        },
        showMonth(i) {
            this.activeStatus = i;
            const setMFrom = new Date(Year, Month - 1, 1);
            const setMTo = new Date(Year, Month - 1, dm);
            const start = moment(setMFrom).format('YYYY-MM-DD hh:mm:ss');
            const end = moment(setMTo).format('YYYY-MM-DD hh:mm:ss');
            if (i === 1 || i === 2 || i === 3) {
                this['dateRange' + i] = [setMFrom, setMTo];
                this.getDiagnosisEchartsData(start, end);
            } else if (i === 4) {
                this.blzddateRange = [setMFrom, setMTo];
                this.diagnosisTJ(start, end);
            }
        },
        showWeek(i) {
            this.activeStatus = i;
            const Nowdate = new Date();
            const WeekFirstDay = new Date(
                Nowdate - (Nowdate.getDay() - 1) * 86400000
            );
            const WeekLastDay = new Date(
                (WeekFirstDay / 1000 + 6 * 86400) * 1000
            );
            const start = moment(WeekFirstDay).format('YYYY-MM-DD hh:mm:ss');
            const end = moment(WeekLastDay).format('YYYY-MM-DD hh:mm:ss');
            if (i === 1 || i === 2 || i === 3) {
                this['dateRange' + i] = [WeekFirstDay, WeekLastDay];
                this.getDiagnosisEchartsData(start, end);
            } else if (i === 4) {
                this.blzddateRange = [WeekFirstDay, WeekLastDay];
                this.diagnosisTJ(start, end);
            }
        },
        /* 三个统计版本用到的方法 */
        blzdchangeDate() {
            console.log('blzd', this.blzdvalue);
            if (this.blzdvalue === '1') {
                this.showYear(4);
            } else if (this.blzdvalue === '2') {
                this.showMonth(4);
            } else if (this.blzdvalue === '3') {
                this.showWeek(4);
            }
        },
        changeDate() {
            console.log('blzd', this.jgsqvalue);
            if (this.jgsqvalue === '1') {
                this.showYear(5);
            } else if (this.jgsqvalue === '2') {
                this.showMonth(5);
            } else if (this.jgsqvalue === '3') {
                this.showWeek(5);
            }
        },
        showDoctorDialog() {
            this.dialogTableVisible = true;
        },
        handleCurrentChange(val) {
            console.log(`当前页: ${val}`);
            this.pageInfo.page = val - 1;
            this.signCount();
        },
        handleSizeChange(val) {
            console.log(`每页 ${val} 条`);
            this.pageInfo.size = val;
            this.signCount();
        },
        selectTime(val, num) {
            this.activeStatus = num;
            if (val) {
                this.getDiagnosisEchartsData(
                    moment(val[0]).format('YYYY-MM-DD hh:mm:ss'),
                    moment(val[1]).format('YYYY-MM-DD hh:mm:ss')
                );
            }
        },
    },
};
/* echarts折线图 */
</script>
<style scoped>
.col-style {
    text-align: center;
}
</style>
